const app = getApp()
var t = getApp(), a = t.requirejs("core"), e = t.requirejs("wxParse/wxParse"), i = t.requirejs("biz/diypage"), s = t.requirejs("biz/diyform"), n = t.requirejs("biz/goodspicker"), o = (t.requirejs("foxui"), 
t.requirejs("jquery"));
Component({
  properties: {
    cid:{
      type:String,
      value:''
    },
  },
  data: {
    statusbar:44,
    barHeight:44,
    search:'',
    category:[],
    dataList:[],
  },
  attached(){
    let that=this;
    wx.getSystemInfo({
      success:function (res) {
        that.setData({
          statusbar :res.statusBarHeight,
          barHeight: wx.getMenuButtonBoundingClientRect().height+((wx.getMenuButtonBoundingClientRect().top- res.statusBarHeight)*2),
        })
      }
    });
    this.getleftListData()
  },
  /**
   * 组件的方法列表
   */
  methods: {
    searchC(e){
      this.setData({
        search:e.detail.value
      })
    },
    getboraderList(e){
      this.setData({
        cid:e.currentTarget.dataset.cid
      });
      this.triggerEvent('changeCid',e.currentTarget.dataset.cid)
      this.getboardlistData()
    },
    goSearch(){
      this.getboardlistData()
    },
    getleftListData(){
      var t = this;
      a.post("sns/board/boardlists", {}, function(res) {
        t.setData({
          category:res.category
        })
      });
      this.getboardlistData()
    },
    getboardlistData(){
      var that = this;
      a.post("sns/board/get_boardlist", {
        cid:that.data.cid,
        keywords:that.data.search,
      }, function(res) {
        that.setData({
          dataList:res.list
        })
      });
    },
    goEssence(e){
      wx.navigateTo({
        url: '/pages/community/essence/index?bid='+e.currentTarget.dataset.bid,
      })
    }
  }
})